package com.gupao.observerdemo.observer.core;

import java.lang.reflect.Method;
import java.util.Date;

public class Event  {

    //事件源
    private Object source;

    //通知目标
    private Object target;

    //回调方法
    private Method callback;

    //触发时间
    private Date date;

    //触发

    public Event(Object target, Method callback) {
        this.target = target;
        this.callback = callback;
    }

    public Object getSource() {
        return source;
    }

    public void setSource(Object source) {
        this.source = source;
    }

    public Object getTarget() {
        return target;
    }

    public void setTarget(Object target) {
        this.target = target;
    }

    public Method getMethod() {
        return callback;
    }

    public void setMethod(Method callback) {
        this.callback = callback;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }


    @Override
    public String toString() {
        return "Event{" + "\n"+
                "source=" + source +"\n"+
                ", target=" + target +"\n"+
                ", callback=" + callback +"\n"+
                ", date=" + date +"\n"+
                '}';
    }
}
